<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>事件冒泡</title>
</head>

<body>
    <div id="container">
        <button>Click me!</button>
    </div>
    <pre id="output"></pre>
    <script>
        const output = document.querySelector("#output");
        function handleClick(e) {
            output.textContent += `You clicked on a ${e.currentTarget.tagName} element\n`;
        }

        const container = document.querySelector("#container");
        container.addEventListener("click", handleClick);



    </script>
</body>

</html>